#include "FrontEndState.h"


FrontEndState::FrontEndState(GameContext& gc)
	:GameState(gc)
{
}


FrontEndState::~FrontEndState()
{
}

void FrontEndState::Load()
{
	mbackground.Load("Spacebackground.jpg");
	mFont.Load(160);
	mFont.SetColor(0,56,78);
	mCursor.Load("sword.png");


	mStartButton1.Load("button_on.png","button_off.png");
	mStartButton1.SetPosition(SVector2(200.0f,500.0f));
	mStartButton1.SetText("Level1",255,255,255);


	mQuitButton.Load("button_on.png","button_off.png");
	mQuitButton.SetPosition(SVector2(200.0,600.0f));
	mQuitButton.SetText("Quit",255,255,255);

}

void FrontEndState::Unload()
{
	mbackground.Unload();
	mFont.Unload();
	mCursor.Unload();
	mStartButton1.Unload();
	mQuitButton.Unload();
}

NextState FrontEndState::Update(float deltaTime)
{
	mbackground.Update(deltaTime);
	mCursor.Update(deltaTime);
	mStartButton1.Update(deltaTime);
	mQuitButton.Update(deltaTime);

	NextState nextstate = None;
	if(mStartButton1.IsPressed())
	{
		mGameContext.SetLevel(1);
		nextstate = Gameplay;
	}
	
	else if(mQuitButton.IsPressed())
	{
		nextstate = Quit;
	}
	return nextstate;
}

void FrontEndState::Render()
{
	mbackground.Render();
	mFont.Print("SpaceSurvival",100,100);
	mStartButton1.Render();
	mQuitButton.Render();
	mCursor.Render();
}

